BX.namespace("BX.UI");if(typeof BX.UI.EntityScheme==="undefined"){BX.UI.EntityScheme=function(){this._id="";this._settings={};this._elements=null;this._availableElements=null};BX.UI.EntityScheme.prototype={initialize:function(t,e){this._id=BX.type.isNotEmptyString(t)?t:BX.util.getRandomString(4);this._settings=e?e:{};this._elements=[];this._availableElements=[];var i,n;var s=BX.prop.getArray(this._settings,"current",[]);for(i=0,n=s.length;i<n;i++){this._elements.push(BX.UI.EntitySchemeElement.create(s[i]))}var r=BX.prop.getArray(this._settings,"available",[]);for(i=0,n=r.length;i<n;i++){this._availableElements.push(BX.UI.EntitySchemeElement.create(r[i]))}},getId:function(){return this._id},getElements:function(){return[].concat(this._elements)},findElementByName:function(t,e){var i=BX.prop.getBoolean(e,"isRecursive",false);if(i){return this.findElementByNameRecursive(this._elements,t)}for(var n=0,s=this._elements.length;n<s;n++){var r=this._elements[n];if(r.getName()===t){return r}}return null},findElementByNameRecursive:function(t,e){if(Array.isArray(t)){for(var i=0,n=t.length;i<n;i++){var s=t[i];if(s.getName()===e){return s}var r=this.findElementByNameRecursive(s._elements,e);if(r){return r}}}return null},getAvailableElements:function(){return[].concat(this._availableElements)},setAvailableElements:function(t){this._availableElements=BX.type.isArray(t)?t:[]}};BX.UI.EntityScheme.create=function(t,e){var i=new BX.UI.EntityScheme;i.initialize(t,e);return i}}if(typeof BX.UI.EntitySchemeElement==="undefined"){BX.UI.EntitySchemeElement=function(){this._settings={};this._name="";this._type="";this._title="";this._hint="";this._originalTitle="";this._optionFlags=0;this._options={};this._isEditable=true;this._isShownAlways=false;this._isTransferable=true;this._isContextMenuEnabled=true;this._isRequired=false;this._isRequiredConditionally=false;this._isRequiredByAttribute=false;this._isPhaseDependent=true;this._isHeading=false;this._isMergeable=true;this._visibilityPolicy=BX.UI.EntityEditorVisibilityPolicy.always;this._data=null;this._elements=null;this._parent=null};BX.UI.EntitySchemeElement.prototype={initialize:function(t){this._settings=t?t:{};this._name=BX.prop.getString(this._settings,"name","");this._type=BX.prop.getString(this._settings,"type","");this._data=BX.prop.getObject(this._settings,"data",{});this.prepareAdditionalParameters();this._isEditable=BX.prop.getBoolean(this._settings,"editable",true);this._isMergeable=BX.prop.getBoolean(this._settings,"mergeable",true);this._isShownAlways=BX.prop.getBoolean(this._settings,"showAlways",false);this._isTransferable=BX.prop.getBoolean(this._settings,"transferable",true);this._isContextMenuEnabled=BX.prop.getBoolean(this._settings,"enabledMenu",true);this._isTitleEnabled=BX.prop.getBoolean(this._settings,"enableTitle",true)&&this.getDataBooleanParam("enableTitle",true);this._isDragEnabled=BX.prop.getBoolean(this._settings,"isDragEnabled",true);this._isPhaseDependent=this.getDataBooleanParam("isPhaseDependent",true);this._isRequired=BX.prop.getBoolean(this._settings,"required",false);this._isRequiredConditionally=BX.prop.getBoolean(this._settings,"requiredConditionally",false);this._isRequiredByAttribute=this.getRequiredByAttributeConfiguration();this._isHeading=BX.prop.getBoolean(this._settings,"isHeading",false);this._visibilityPolicy=BX.UI.EntityEditorVisibilityPolicy.parse(BX.prop.getString(this._settings,"visibilityPolicy",""));var e=BX.prop.getString(this._settings,"hint","");var i=BX.prop.getString(this._settings,"title","");var n=BX.prop.getString(this._settings,"originalTitle","");var s=BX.prop.getString(this._settings,"lockText","");if(i!==""&&n===""){n=i}else if(n!==""&&i===""){i=n}this._hint=e;this._title=i;this._originalTitle=n;this._lockText=s;this._optionFlags=BX.prop.getInteger(this._settings,"optionFlags",0);this._options=BX.prop.getObject(this._settings,"options",{});this._elements=[];var r=BX.prop.getArray(this._settings,"elements",[]);for(var a=0,l=r.length;a<l;a++){this._elements.push(BX.UI.EntitySchemeElement.create(r[a]))}},prepareAdditionalParameters:function(){var t=this._data.fieldInfo||null;if(t&&t.ADDITIONAL===undefined&&t.USER_TYPE_ID===BX.UI.EntityUserFieldType.file&&BX.UI.EntitySchemeElement.userFieldFileUrlTemplate!==undefined){var e=BX.UI.EntitySchemeElement.userFieldFileUrlTemplate;e=e.replace("#owner_id#",t.ENTITY_VALUE_ID).replace("#field_name#",t.FIELD);t.ADDITIONAL={};t.ADDITIONAL.URL_TEMPLATE=e}},mergeSettings:function(t){this.initialize(BX.mergeEx(this._settings,t))},getName:function(){return this._name},getType:function(){return this._type},getHint:function(){return this._hint},getLockText:function(){return this._lockText},getTitle:function(){return this._title},setTitle:function(t){this._title=this._settings["title"]=t},getOriginalTitle:function(){return this._originalTitle},hasCustomizedTitle:function(){return this._title!==""&&this._title!==this._originalTitle},resetOriginalTitle:function(){this._originalTitle=this._title},getOptionFlags:function(){return this._optionFlags},setOptionFlags:function(t){this._optionFlags=this._settings["optionFlags"]=t},areAttributesEnabled:function(){return BX.prop.getBoolean(this._settings,"enableAttributes",true)},isEditable:function(){return this._isEditable},isShownAlways:function(){return this._isShownAlways},isTransferable:function(){return this._isTransferable},isRequired:function(){return this._isRequired},isRequiredConditionally:function(){return this._isRequiredConditionally},isRequiredByAttribute:function(){return this._isRequiredByAttribute},isContextMenuEnabled:function(){return this._isContextMenuEnabled},isTitleEnabled:function(){return this._isTitleEnabled},isDragEnabled:function(){return this._isDragEnabled},isHeading:function(){return this._isHeading},isMergeable:function(){return this._isMergeable},needShowTitle:function(){return BX.prop.getBoolean(this._settings,"showTitle",true)},isVirtual:function(){return BX.prop.getBoolean(this._settings,"virtual",false)},getCreationPlaceholder:function(){return BX.prop.getString(BX.prop.getObject(this._settings,"placeholders",null),"creation","")},getChangePlaceholder:function(){return BX.prop.getString(BX.prop.getObject(this._settings,"placeholders",null),"change","")},getVisibilityPolicy:function(){return this._visibilityPolicy},getData:function(){return this._data},setData:function(t){this._data=t},getDataParam:function(t,e){return BX.prop.get(this._data,t,e)},setDataParam:function(t,e){this._data[t]=e},getDataStringParam:function(t,e){return BX.prop.getString(this._data,t,e)},getDataIntegerParam:function(t,e){return BX.prop.getInteger(this._data,t,e)},getDataBooleanParam:function(t,e){return BX.prop.getBoolean(this._data,t,e)},getDataObjectParam:function(t,e){return BX.prop.getObject(this._data,t,e)},getDataArrayParam:function(t,e){return BX.prop.getArray(this._data,t,e)},getInnerConfig:function(){var t=this.getDataObjectParam("innerConfig",{});var e=BX.Type.isPlainObject(t)&&t.hasOwnProperty("type")&&BX.Type.isStringFilled(t["type"])&&t.hasOwnProperty("controller")&&BX.Type.isStringFilled(t["controller"])&&t.hasOwnProperty("statusType")&&BX.Type.isStringFilled(t["statusType"])&&t.hasOwnProperty("itemsConfig")&&BX.Type.isPlainObject(t["itemsConfig"]);return e?t:null},getElements:function(){return this._elements},setElements:function(t){this._elements=t},findElementByName:function(t){for(var e=0,i=this._elements.length;e<i;e++){var n=this._elements[e];if(n.getName()===t){return n}}return null},getAffectedFields:function(){var t=this.getDataArrayParam("affectedFields",[]);if(t.length===0){t.push(this._name)}return t},getParent:function(){return this._parent},setParent:function(t){this._parent=t instanceof BX.UI.EntitySchemeElement?t:null},hasAttributeConfiguration:function(t){return!!this.getAttributeConfiguration(t)},getAttributeConfiguration:function(t){var e=this.getData();var i=BX.prop.getArray(e,"attrConfigs",null);if(!i){return null}for(var n=0,s=i.length;n<s;n++){var r=i[n];if(BX.prop.getInteger(r,"typeId",BX.UI.EntityFieldAttributeType.undefined)===t){return BX.clone(r)}}return null},setAttributeConfiguration:function(t){var e=BX.prop.getInteger(t,"typeId",BX.UI.EntityFieldAttributeType.undefined);if(typeof this._data["attrConfigs"]==="undefined"){this._data["attrConfigs"]=[]}var i=-1;for(var n=0,s=this._data["attrConfigs"].length;n<s;n++){if(BX.prop.getInteger(this._data["attrConfigs"][n],"typeId",BX.UI.EntityFieldAttributeType.undefined)===e){i=n;break}}if(i>=0){this._data["attrConfigs"].splice(i,1,t)}else{this._data["attrConfigs"].push(t)}this._isRequiredByAttribute=this.getRequiredByAttributeConfiguration()},removeAttributeConfiguration:function(t){if(typeof this._data["attrConfigs"]!=="undefined"){for(var e=0,i=this._data["attrConfigs"].length;e<i;e++){if(BX.prop.getInteger(this._data["attrConfigs"][e],"typeId",BX.UI.EntityFieldAttributeType.undefined)===t){this._data["attrConfigs"].splice(e,1);break}}}this._isRequiredByAttribute=this.getRequiredByAttributeConfiguration()},getRequiredByAttributeConfiguration:function(){var t=false;var e=false;if(typeof this._data["attrConfigs"]==="undefined"){e=true}if(!e){for(var i=0,n=this._data["attrConfigs"].length;i<n;i++){if(BX.prop.getInteger(this._data["attrConfigs"][i],"typeId",BX.UI.EntityFieldAttributeType.undefined)===BX.UI.EntityFieldAttributeType.required){if(this._isPhaseDependent){var s=this._data["attrConfigs"][i];if(s.hasOwnProperty("groups")&&BX.Type.isArray(s["groups"])){for(var r=0;r<=s["groups"].length;r++){if(BX.Type.isPlainObject(s["groups"][r])){var a=s["groups"][r];if(a.hasOwnProperty("phaseGroupTypeId")){if(parseInt(a["phaseGroupTypeId"])===BX.UI.EntityFieldAttributePhaseGroupType.general){t=true;e=true;break}}}}}}else{t=true;e=true}if(e){break}}}}return t},setVisibilityConfiguration:function(t){this._data["visibilityConfigs"]=t},removeVisibilityConfiguration:function(t){this._data["visibilityConfigs"]={}},createConfigItem:function(){var t={name:this._name};if(this._type==="column"){t["type"]="column";t["data"]=this._data;t["elements"]=[];for(var e=0,i=this._elements.length;e<i;e++){t["elements"].push(this._elements[e].createConfigItem())}}else if(this._type==="section"){t["type"]="section";t["data"]=this._data;if(this._title!==""){t["title"]=this._title}t["elements"]=[];for(var e=0,i=this._elements.length;e<i;e++){t["elements"].push(this._elements[e].createConfigItem())}}else if(this._type==="included_area"){t["type"]="included_area";t["data"]=this._data;if(this._title!==""){t["title"]=this._title}}else{if(this._title!==""&&this._title!==this._originalTitle){t["title"]=this._title}if(this._optionFlags>0){t["optionFlags"]=this._optionFlags}t["options"]=this._options}return t},clone:function(){return BX.UI.EntitySchemeElement.create(BX.clone(this._settings))}};BX.UI.EntitySchemeElement.create=function(t){var e=new BX.UI.EntitySchemeElement;e.initialize(t);return e}}
//# sourceMappingURL=scheme.map.js